﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Linq;
using FlowgraphViewer.Model;

namespace FlowgraphViewer.Panels
{
    public class FlowgraphPanel : Panel
    {

        public FlowgraphPanel()
            : base()
        {

        }

        protected override Size ArrangeOverride(Size finalSize)
        {
            foreach (var item in Children.OfType<ContentPresenter>())
            {
                FlowNodeInstance fni = item.DataContext as FlowNodeInstance;

                if (fni != null)
                {
                    Canvas.SetLeft(item, fni.Position.X);
                    Canvas.SetTop(item, fni.Position.Y);
                }
            }


            
            
            return base.ArrangeOverride(finalSize);
        }

    }
}
